#include "Global.h"

void trace(char* format, ...)
{
	char *_traceFile = "..\\game.log";
	int _traceNum = 1;

	if (!_traceNum) return;

	FILE *f = stderr;
	if (_traceFile != NULL)
	{
		if (fopen_s(&f, _traceFile, "w") != 0)
		{
			fprintf(stderr, "WARNING: Failed to open trace file '%s' for writing!\n", _traceFile);
			return;
		}
	}
	va_list ap;
	va_start(ap, format);
	fprintf(f, format, ap);
	va_end(ap);
	fprintf(f, "\n");
	if (_traceFile != NULL) fclose(f);
}

void output_print(const char* format, ...)
{
	va_list pArg;
	va_start(pArg, format);
	char buf[1000];
	vsnprintf_s(buf, 1000, format, pArg);
	OutputDebugString(buf);
	va_end(pArg);
}